package com.test05.anotation1;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
 
public class UserServiceTester {
 
    public static void main(String[] args) {
        Properties properties = new Properties();
 
        try {
            String path = UserServiceTester.class.getResource("/com/test05/anotation1/db.properties").getPath();
            InputStream in = new FileInputStream(path);
            properties.load(in);
            in.close();
        } catch(IOException ex) {
            ex.printStackTrace();
        }
 
        UserService config = PropertyTool.bindProperties(UserService.class, properties);
        System.out.println("User Name: " + config.getUserName());
        System.out.println("Password: " + config.getPassword());
    }
}